﻿package mortal.game.view.task
{
    import Framework.MQ.*;
    import Message.Command.*;
    import Message.DB.Tables.*;
    import Message.Game.*;
    import Message.Public.*;
    import com.gengine.core.frame.*;
    import com.gengine.global.*;
    import com.mui.controls.*;
    import com.mui.utils.*;
    import extend.language.*;
    import fl.data.*;
    import flash.geom.*;
    import flash.utils.*;
    import mortal.component.gLinkText.*;
    import mortal.component.gconst.*;
    import mortal.game.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.scene3D.ai.*;
    import mortal.game.scene3D.ai.ais.*;
    import mortal.game.scene3D.map3D.AstarAnyDirection.data.*;
    import mortal.game.scene3D.map3D.sceneInfo.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.utils.*;
    import mortal.game.view.chat.*;
    import mortal.game.view.chat.chatPanel.*;
    import mortal.game.view.chat.chatViewData.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.guide.data.*;
    import mortal.game.view.copy.groupCopy.*;
    import mortal.game.view.daily.*;
    import mortal.game.view.guide.guideUse.*;
    import mortal.game.view.task.data.*;
    import mortal.game.view.task.drama.*;
    import mortal.game.view.task.guild.*;
    import mortal.mvc.core.*;

    public class TaskImplController extends Controller
    {
        private var _guildTaskGetWin:GuildTaskGetWinNew;
        private var _guildTaskShareListWin:GuildTaskShareListWin;
        private var _n:int = 0;

        public function TaskImplController()
        {
            return;
        }// end function

        override protected function initServer() : void
        {
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicGetOrangeGuildTask, this.guildTaskSomeOneGotHandler);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicShareGuildTask, this.guildTaskSharedHandler);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicDemandShareTask, this.guideTaskDemandShareHandler);
            NetDispatcher.addCmdListener(ServerCommand.TaskGuildShareSuccess, this.shareSuccessHandler);
            NetDispatcher.addCmdListener(ServerCommand.TaskGuildTaskGetGuildShareList, this.guildTaskListHandler);
            Dispatcher.addEventListener(EventName.GuildTaskShowShareTaskListOnly, this.showGuildShareTaskOnly);
            Dispatcher.addEventListener(EventName.TaskGuildShowShareWin, this.showShareTaskWinHandler);
            Dispatcher.addEventListener(EventName.TaskGuildShowGetWin, this.showGetGuildTaskWinHandler);
            Dispatcher.addEventListener(EventName.TaskGuildGot, this.gotGuildTaskHandler);
            Dispatcher.addEventListener(EventName.TaskGuildGetShareTask, this.getGuildShareTaskHandler);
            Dispatcher.addEventListener(EventName.TaskGuildAskShareTask, this.askGuildShareTaskHandler);
            Dispatcher.addEventListener(EventName.GuildTaskFlyToGetShareTask, this.flyToGetGuildShareTaskhandler);
            Dispatcher.addEventListener(EventName.NPC_OutCurNpcDistance, this.outNpcDistanceHandler);
            Dispatcher.addEventListener(EventName.TaskGroupCountChange, this.groupCountChangeHandler);
            Dispatcher.addEventListener(EventName.TaskTrackClickEvent, this.taskEventHandler);
            Dispatcher.addEventListener(EventName.TaskClickBranchGuide, this.linkBranchGuideHandler);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateTaskGuildColor, this.guildTaskColorHandler);
            return;
        }// end function

        private function guildTaskColorHandler(param1:MessageBlock) : void
        {
            var _loc_2:* = param1.messageBase as SPublicInt;
            cache.task.guildTaskColor = _loc_2.publicInt;
            if (this._guildTaskGetWin != null && !this._guildTaskGetWin.isHide)
            {
                this._guildTaskGetWin.updateTaskColor(_loc_2.publicInt);
            }
            return;
        }// end function

        private function taskEventHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as Array;
            var _loc_3:* = _loc_2[0] as String;
            var _loc_4:* = _loc_2[1] as GLinkTextData;
            switch(_loc_3)
            {
                case EventName.TaskGuideOpenDaily:
                {
                    DailyModule._isByCustom = true;
                    GameManager.instance.popupModuleType(ModuleType.Daily);
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        private function linkBranchGuideHandler(event:DataEvent) : void
        {
            var _loc_4:Boolean = false;
            var _loc_2:* = event.data[1];
            var _loc_3:* = event.data[0] as GLinkTextData;
            switch(_loc_2)
            {
                case EventName.TaskGuideCreateGuild:
                {
                    MsgManager.showRollTipsMsg(Language.getString(21207));
                    break;
                }
                case EventName.TaskGuideDefenceCopy:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.GroupCopyOpenByIndexOpenOnly, "m3"));
                    break;
                }
                case EventName.TaskGuideChanllengeCopy:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.ChallengeCopyOpen, {floor:_loc_3.x, level:_loc_3.y}));
                    break;
                }
                case EventName.TaskGuideGroupCopy:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.GroupCopyOpenByIndexOpenOnly, "m1"));
                    break;
                }
                case EventName.TaskGuideSingleCopy:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.GroupCopyOpenByIndexOpenOnly, "m2"));
                    break;
                }
                case EventName.TaskGuideGuildTask:
                {
                    this.linkTaskGroup(ETaskGroup._ETaskGroupGuild, Language.getString(21208));
                    break;
                }
                case EventName.TaskGuideLoopTask:
                {
                    this.linkTaskGroup(ETaskGroup._ETaskGroupLoop, Language.getString(21209));
                    break;
                }
                case EventName.TaskGuideMountLevel:
                {
                    GameManager.instance.popupModuleType(ModuleType.Mounts);
                    break;
                }
                case EventName.TaskGuidePetGrouth:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.PetMoudleChangeTabIndex, PetConst.TAB_INDEX_1));
                    break;
                }
                case EventName.TaskGuideEquipStrenthen:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.OpenForgingPanel, Language.getString(21210)));
                    MsgManager.showRollTipsMsg(Language.getString(21211));
                    break;
                }
                case EventName.TaskGuideSpriteLevel:
                {
                    GameManager.instance.popupModuleType(ModuleType.Wizard);
                    break;
                }
                case EventName.TaskGuideAcupointLevel:
                {
                    GameManager.instance.popupModuleType(ModuleType.Wizard);
                    break;
                }
                case EventName.TaskGuideJewelAdvance:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.OpenForgingPanel, Language.getString(21212)));
                    break;
                }
                case EventName.TaskGuideEquipRefresh:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.OpenForgingPanel, Language.getString(21213)));
                    break;
                }
                case EventName.TaskGuideEnterGuild:
                {
                    this.guideEnterGuild();
                    break;
                }
                case EventName.TaskGuideEnterTowerCopy:
                {
                    this.guideEnterTowerCopy();
                    break;
                }
                case EventName.TaskGuideEquipQuality:
                {
                    this.guideQuality();
                    break;
                }
                case EventName.TaskGuideTowerCopy:
                {
                    this.guideTowerCopy();
                    break;
                }
                case EventName.TaskGuieePetMerge:
                {
                    this.guidePetMerge();
                    break;
                }
                case EventName.TaskGuidePetSkill:
                {
                    this.guidePetSkill();
                    break;
                }
                case EventName.TaskGuideLoopTaskCount:
                {
                    this.guideBySubType(ETaskGroup._ETaskGroupLoop, Language.getStringByParam(21216, Language.getString(21209)));
                    break;
                }
                case EventName.TaskGuideGuildTaskCount:
                {
                    this.guideBySubType(ETaskGroup._ETaskGroupGuild, Language.getStringByParam(21216, Language.getString(21208)));
                    break;
                }
                case EventName.TaskGuidePvpCount:
                {
                    this.guideBySubType(ETaskGroup._ETaskGroupPvp, Language.getStringByParam(21216, Language.getString(21215)));
                    break;
                }
                case EventName.TaskGuideAutoFightCount:
                {
                    this.guideBySubType(ETaskGroup._ETaskGroupAutoFight, Language.getStringByParam(21216, Language.getString(21217)));
                    break;
                }
                case EventName.TaskGuideMiningCount:
                {
                    this.guideBySubType(ETaskGroup._ETaskGroupMinning, Language.getStringByParam(21216, Language.getString(21218)));
                    break;
                }
                case EventName.TaskGuideToAutoFight2:
                {
                    _loc_4 = event.data[0] as Boolean;
                    this.guideToAutoFight(this.getAutoFightPoint(), _loc_4);
                    break;
                }
                case EventName.TaskGuideTaskAutoFight:
                {
                    this.guideToAutoFight(this.getAutoFightPoint(_loc_3.mapId, false), false);
                    break;
                }
                case EventName.TaskGuideToFightBoss:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.WorldBossEnterWindowShow));
                    break;
                }
                case EventName.TaskGuideTrackVipCopy:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideOpenCopyTab, "m4"));
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public function guideTaskFly(param1:GLinkTextData) : void
        {
            var _loc_9:String = null;
            var _loc_10:Array = null;
            var _loc_11:int = 0;
            var _loc_12:int = 0;
            var _loc_13:int = 0;
            var _loc_14:Number = NaN;
            var _loc_15:int = 0;
            var _loc_16:Number = NaN;
            if (TaskDramaOperator.isInFlyDrama)
            {
                return;
            }
            if (!Game.isSceneInit() || Game.mapInfo.mapId != param1.mapId)
            {
                return;
            }
            var _loc_2:* = TaskConfig.instance.getPath(param1.value1);
            if (_loc_2 == null)
            {
                MsgManager.showRollTipsMsg("找不到TPath，id=" + param1.value1);
                return;
            }
            var _loc_3:* = _loc_2.path.split(";");
            var _loc_4:Array = [];
            var _loc_5:Array = [];
            var _loc_6:* = RolePlayer.instance.x2d;
            var _loc_7:* = RolePlayer.instance.y2d;
            var _loc_8:int = 0;
            while (_loc_8 < (_loc_3.length - 1))
            {
                
                _loc_9 = _loc_3[_loc_8];
                _loc_10 = _loc_9.split(",");
                _loc_11 = int(_loc_10[0]);
                _loc_12 = int(_loc_10[1]);
                _loc_13 = int(_loc_10[2]);
                _loc_14 = parseFloat(_loc_10[3]);
                _loc_15 = GeomUtil.calcDistance(_loc_6, _loc_7, _loc_11, _loc_12);
                _loc_16 = _loc_15 / _loc_13;
                _loc_4.push(_loc_11);
                _loc_4.push(_loc_12);
                _loc_5.push(_loc_13);
                _loc_5.push(_loc_14);
                _loc_5.push(_loc_16);
                _loc_6 = _loc_11;
                _loc_7 = _loc_12;
                _loc_8++;
            }
            GameController.task.dramaOperator.flyToSky(_loc_4, _loc_5);
            return;
        }// end function

        public function guideToAutoFight(param1:SPassTo, param2:Boolean) : void
        {
            var pt:* = param1;
            var isFlyBoot:* = param2;
            if (pt == null)
            {
                return;
            }
            if (isFlyBoot)
            {
                var flyed:* = function () : void
            {
                AIManager.cancelAll();
                AIManager.addFlyBoot(pt);
                AIManager.addDelayAI(500);
                AIManager.addAutoFight(600);
                AIManager.start();
                return;
            }// end function
            ;
                if (!FlyBootAI.checkCanFly())
                {
                    return;
                }
                GameController.guide.checkAndBuyFlyBoot(flyed);
            }
            else
            {
                var moveToed:* = function () : void
            {
                AIManager.addAutoFight(600);
                if (!AIManager.isWorking)
                {
                    AIManager.start();
                }
                return;
            }// end function
            ;
                AIManager.cancelAll();
                AIManager.addMoveToOtherMap(Game.mapInfo.mapId, pt.mapId, new Point(pt.toPoint.x, pt.toPoint.y), 100, moveToed);
                if (!AIManager.isWorking)
                {
                    AIManager.start();
                }
            }
            return;
        }// end function

        public function getAutoFightPoint(param1:int = -1, param2:Boolean = true, param3:Boolean = false) : SPassTo
        {
            var _loc_4:* = new SPassTo();
            _loc_4.toPoint = new SPoint();
            if (param1 == -1)
            {
                param1 = GameController.smallMap.getAutofightMapId(param2, -1, param3);
            }
            var _loc_5:* = SceneConfig.instance.getSceneInfo(param1);
            var _loc_6:* = _loc_5.bossRefreshs;
            if (_loc_6 == null || _loc_6.length == 0)
            {
                MsgManager.showRollTipsMsg(Language.getString(21219));
                return null;
            }
            var _loc_7:* = _loc_6.length;
            var _loc_8:* = int(Math.random() * _loc_7);
            var _loc_9:* = _loc_6[_loc_8] as BossRefreshInfo;
            _loc_4.toPoint.x = _loc_9.x;
            _loc_4.toPoint.y = _loc_9.y;
            _loc_4.mapId = param1;
            return _loc_4;
        }// end function

        public function guideBySubType(param1:int, param2:String) : void
        {
            var _loc_4:TaskInfo = null;
            var _loc_5:GLinkTextData = null;
            var _loc_3:* = cache.task.getLinkTextDataByGroup(param1);
            if (_loc_3 == null || _loc_3.length == 0)
            {
                MsgManager.showRollTipsMsg(param2);
            }
            else
            {
                _loc_4 = (_loc_3[0][0] as GLinkTextData).data as TaskInfo;
                _loc_5 = _loc_3[_loc_4.curStep][0] as GLinkTextData;
                if (_loc_5 == null)
                {
                    MsgManager.showRollTipsMsg(param2);
                }
                else if (_loc_5.type == GLinkTextData.branchGuide)
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.TaskClickBranchGuide, [_loc_5, ""]));
                }
                else
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.TaskTraceTargetEvent, _loc_5));
                }
            }
            return;
        }// end function

        public function guidePetSkill() : void
        {
            var data:AutoGuideData;
            var stone:ItemData;
            var str:String;
            var win:GuideUsePetStoneWin;
            var books:* = cache.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupStuff, EStuff._EStuffAdvance, EAdvanceType._EAdvanceTypePet);
            var len:* = books.length;
            if (len > 0)
            {
                GameManager.instance.popupModuleType(ModuleType.Pets);
                Dispatcher.dispatchEvent(new DataEvent(EventName.PetMoudleChangeTabIndex, PetConst.TAB_INDEX_3));
                data = AutoGuideConfig.instance.getConfigs(["mainId", "stepId"], [32, 2])[0] as AutoGuideData;
                data.clickChildName = (96 + len * 62).toString() + ";454;40;40";
                Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideActiveByEvent, {mainId:32, stepId:2}));
                return;
            }
            var stones:* = cache.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupProp, EProp._EPropProp, EPropType._EPropTypePetSkillRand);
            if (stones.length > 0)
            {
                var closeHandler:* = function (param1:int) : void
            {
                if (param1 == Alert.OK)
                {
                    GameController.pack.useItem(stone);
                }
                return;
            }// end function
            ;
                stone = stones[0];
                Alert.alertWinRenderer = GuideUsePetStoneWin;
                str = Language.getString(21220);
                win = Alert.show(str, "", Alert.OK | Alert.CANCEL, null, closeHandler) as GuideUsePetStoneWin;
                win.setPetEgg(stone);
                return;
            }
            GameManager.instance.popupModuleType(ModuleType.Pets);
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetMoudleChangeTabIndex, PetConst.TAB_INDEX_3));
            MsgManager.showRollTipsMsg(Language.getString(21221));
            return;
        }// end function

        private function guideQuality() : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.OpenForgingPanel, Language.getString(21222)));
            return;
        }// end function

        private function guideTowerCopy() : void
        {
            var _loc_1:int = 1;
            if (GameController.autoGuide.hasGuideMainId(26))
            {
                _loc_1 = 3;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideActiveByEvent, {mainId:26, stepId:_loc_1}));
            return;
        }// end function

        public function guidePetMerge() : void
        {
            var egg:ItemData;
            var str:String;
            var win:GuideUsePetEggWin;
            AutoGuideCache.isGuidingPetEgg = false;
            var pets:* = cache.pet.pets;
            var pLen:int;
            if (pets != null)
            {
                pLen = pets.length;
            }
            if (pLen >= 2)
            {
                GameManager.instance.popupModuleType(ModuleType.Pets);
                Dispatcher.dispatchEvent(new DataEvent(EventName.PetMoudleChangeTabIndex, PetConst.TAB_INDEX_5));
                Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideActiveByEvent, {mainId:19, stepId:3}));
                return;
            }
            var eggs:* = cache.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupProp, EProp._EPropProp, EPropType._EPropTypePetEgg);
            var len:* = eggs.length;
            if (len > 0)
            {
                var closeHandler:* = function (param1:int) : void
            {
                if (param1 == Alert.OK)
                {
                    AutoGuideCache.isGuidingPetEgg = true;
                    GameProxy.packProxy.useItem(egg.serverData.uid, egg.itemCode);
                }
                return;
            }// end function
            ;
                egg = eggs[0];
                Alert.alertWinRenderer = GuideUsePetEggWin;
                str = Language.getString(21223);
                win = Alert.show(str, "", Alert.OK | Alert.CANCEL, null, closeHandler) as GuideUsePetEggWin;
                win.setPetEgg(egg);
            }
            else
            {
                MsgManager.showRollTipsMsg(Language.getString(21224));
                GameManager.instance.popupModuleType(ModuleType.Pets);
                Dispatcher.dispatchEvent(new DataEvent(EventName.PetMoudleChangeTabIndex, PetConst.TAB_INDEX_5));
            }
            return;
        }// end function

        private function guideEnterTowerCopy() : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideActiveByEvent, {mainId:26, stepId:2}));
            return;
        }// end function

        private function guideEnterGuild() : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideActiveByEvent, {mainId:25, stepId:2}));
            return;
        }// end function

        private function linkTaskGroup(param1:int, param2:String) : void
        {
            var _loc_3:* = cache.task.getTaskByGroupInTaskDoing(param1);
            if (_loc_3.length > 0)
            {
            }
            else
            {
                _loc_3 = cache.task.getTaskByGroupInTaskCanget(param1);
                if (_loc_3.length == 0)
                {
                    MsgManager.showRollTipsMsg(param2);
                    return;
                }
            }
            var _loc_4:* = _loc_3[0];
            var _loc_5:* = cache.task.getCurLinkTextDatas(_loc_4)[0];
            Dispatcher.dispatchEvent(new DataEvent(EventName.TaskTraceTargetEvent, _loc_5));
            return;
        }// end function

        private function groupCountChangeHandler(event:DataEvent) : void
        {
            if (this._guildTaskGetWin != null && !this._guildTaskGetWin.isHide)
            {
                this._guildTaskGetWin.updateTodayTimes();
            }
            return;
        }// end function

        private function guildTaskListHandler(param1:Array) : void
        {
            var _loc_4:GuildTaskShareListData = null;
            if (this._guildTaskShareListWin == null || this._guildTaskShareListWin.isHide)
            {
                return;
            }
            var _loc_2:* = new DataProvider();
            var _loc_3:int = 0;
            while (_loc_3 < param1.length)
            {
                
                _loc_4 = new GuildTaskShareListData();
                _loc_4.shareData = param1[_loc_3] as SGuildTaskShare;
                _loc_4.needBg = _loc_3 % 2 == 0;
                _loc_2.addItem(_loc_4);
                _loc_3++;
            }
            this._guildTaskShareListWin.updateDatas(_loc_2);
            return;
        }// end function

        private function shareSuccessHandler(param1) : void
        {
            return;
        }// end function

        private function askGuildShareTaskHandler(event:DataEvent) : void
        {
            var _loc_2:* = int(event.data);
            var _loc_3:* = cache.task.getGuildOrangeTask(_loc_2);
            if (_loc_3 != null)
            {
                GameProxy.task.askShareGuildTask(_loc_3.entityId);
            }
            return;
        }// end function

        private function flyToGetGuildShareTaskhandler(event:DataEvent) : void
        {
            var _loc_4:TaskInfo = null;
            var _loc_2:* = Cache.instance.task.getTaskInfoByGroup(ETaskGroup._ETaskGroupGuild);
            if (_loc_2 == null)
            {
                if (cache.role.roleEntityInfo.entityInfo.level < 45)
                {
                    MsgManager.showRollTipsMsg(Language.getString(21225));
                }
                else
                {
                    MsgManager.showRollTipsMsg(Language.getString(21226));
                }
                return;
            }
            if (!_loc_2.isCanget())
            {
                _loc_4 = new TaskInfo();
                _loc_4.stask = _loc_2.stask;
                _loc_4.playerTask = _loc_2.playerTask;
                _loc_4.status = ETaskStatus._ETaskStatusCanGet;
                _loc_2 = _loc_4;
            }
            var _loc_3:* = Boolean(event.data);
            TaskUtil.linkTask(_loc_2, _loc_3);
            return;
        }// end function

        private function getGuildShareTaskHandler(event:DataEvent) : void
        {
            var _loc_6:TaskInfo = null;
            var _loc_2:* = Cache.instance.task.getTaskByGroupInTaskDoing(ETaskGroup._ETaskGroupGuild);
            if (_loc_2 == null || _loc_2.length == 0)
            {
                MsgManager.showRollTipsMsg(Language.getString(21227));
                return;
            }
            var _loc_3:* = _loc_2[0];
            if (_loc_3 == null || _loc_3.isComplete())
            {
                MsgManager.showRollTipsMsg(Language.getString(21228));
                return;
            }
            if (_loc_3.playerTask.canShare)
            {
                MsgManager.showRollTipsMsg(Language.getString(21229));
                return;
            }
            var _loc_4:* = int(event.data);
            var _loc_5:* = cache.task.getGuildShareTaskEntity(_loc_4);
            if (_loc_5 != null)
            {
                _loc_6 = cache.task.getTaskByCode(_loc_5.shareTask.code);
                if (_loc_6 != null && _loc_6.isDoing() && _loc_6.playerTask.extend >= EColor._EColorOrange)
                {
                    return;
                }
                GameProxy.task.getSharedGuildTask(_loc_5.entityId, _loc_5.id);
                cache.task._getSharedTime = FrameManager.flashFrame.getTime();
                GameProxy.task.guildTaskGetShareList();
            }
            return;
        }// end function

        private function outNpcDistanceHandler(event:DataEvent) : void
        {
            if (this._guildTaskGetWin != null && !this._guildTaskGetWin.isHide)
            {
                this._guildTaskGetWin.hide();
            }
            return;
        }// end function

        private function gotGuildTaskHandler(event:DataEvent) : void
        {
            var _loc_3:String = null;
            var _loc_5:ColorInfo = null;
            var _loc_2:* = event.data as SPlayerTask;
            if (_loc_2.extend >= EColor._EColorGreen)
            {
                _loc_5 = ColorConfig.instance.getItemColor(_loc_2.extend);
                _loc_3 = Language.getStringByParam(21230, _loc_5.color, _loc_5.colorText);
            }
            MsgManager.showRollTipsMsg(_loc_3);
            var _loc_4:* = cache.task.getTaskByCode(_loc_2.task.code);
            if (_loc_2.canShare)
            {
                GuildTaskGetWinNew.needClickShare = true;
                Dispatcher.dispatchEvent(new DataEvent(EventName.TaskGuildShowShareWin, _loc_4));
            }
            if (this._guildTaskGetWin != null && !this._guildTaskGetWin.isHide)
            {
                this._guildTaskGetWin.setInfos(_loc_4, cache.task.guildTaskColor);
            }
            return;
        }// end function

        private function showGuildShareTaskOnly(param1) : void
        {
            if (this._guildTaskShareListWin == null)
            {
                this._guildTaskShareListWin = UICompomentPool.getUICompoment(GuildTaskShareListWin) as GuildTaskShareListWin;
            }
            if (!this._guildTaskShareListWin.isHide)
            {
                return;
            }
            this._guildTaskShareListWin.layer = LayerManager.windowLayer;
            this._guildTaskShareListWin.show(Global.stage.stageWidth - 505, Global.stage.stageHeight / 2 - 246);
            return;
        }// end function

        private function showGetGuildTaskWinHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as TaskInfo;
            if (this._guildTaskGetWin == null)
            {
                this._guildTaskGetWin = UICompomentPool.getUICompoment(GuildTaskGetWinNew) as GuildTaskGetWinNew;
            }
            this._guildTaskGetWin.show();
            this._guildTaskGetWin.setInfos(_loc_2, cache.task.guildTaskColor);
            if (this._guildTaskShareListWin == null)
            {
                this._guildTaskShareListWin = UICompomentPool.getUICompoment(GuildTaskShareListWin) as GuildTaskShareListWin;
            }
            this._guildTaskShareListWin.layer = this._guildTaskGetWin;
            this._guildTaskShareListWin.show(765, 0);
            return;
        }// end function

        private function showShareTaskWinHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as TaskInfo;
            this._n = 0;
            return;
        }// end function

        private function guideTaskDemandShareHandler(param1:MessageBlock) : void
        {
            var _loc_2:* = param1.messageBase as STaskGuildSharePlayer;
            var _loc_3:String = this;
            var _loc_4:* = this._n + 1;
            _loc_3._n = _loc_4;
            MsgManager.showRollTipsMsg(Language.getStringByParam(21231, _loc_2.name, this._n));
            return;
        }// end function

        private function guildTaskSomeOneGotHandler(param1:MessageBlock) : void
        {
            var task:STaskGuildSharePlayer;
            var timeOut:Function;
            var mb:* = param1;
            timeOut = function () : void
            {
                var _loc_1:* = Language.getStringByParam(21232, task.name) + "<MsgObj>GUILDTASK_ASK_SHARE," + task.entityId.id + "</MsgObj>";
                GameController.chat.addTipMsg(_loc_1, ChatType.Union, ChatArea.Union, 2, null, ChatStyle.getTitleColor(ChatType.Union));
                return;
            }// end function
            ;
            task = mb.messageBase as STaskGuildSharePlayer;
            cache.task.addGuildOrangeTask(task);
            setTimeout(timeOut, 6000);
            return;
        }// end function

        private function guildTaskSharedHandler(param1:MessageBlock) : void
        {
            var _loc_2:* = param1.messageBase as STaskGuildShare;
            cache.task.addGuildShareTask(_loc_2);
            var _loc_3:* = Language.getStringByParam(21233, _loc_2.name, _loc_2.shareTask.name) + "<MsgObj>GUILDTASK_GET," + _loc_2.entityId.id + "</MsgObj>";
            if (_loc_2.entityId.id == cache.role.entityInfo.entityId.id)
            {
                _loc_3 = Language.getStringByParam(21234, cache.role.entityInfo.name);
            }
            GameController.chat.addTipMsg(_loc_3, ChatType.Union, ChatArea.Union, 2, null, ChatStyle.getTitleColor(ChatType.Union));
            return;
        }// end function

        public function checkInGuideDefensecopy(param1:GLinkTextData) : Boolean
        {
            var _loc_3:int = 0;
            var _loc_2:* = param1.data as TaskInfo;
            if (_loc_2 != null && _loc_2.stask.code == GameConst.GuideDefenceCopyTaskEnterCode && _loc_2.isDoing())
            {
                _loc_3 = getTimer();
                Dispatcher.dispatchEvent(new DataEvent(EventName.GroupCopyOpenByIndexOpenOnly, GroupCopyModule.DefenCopy));
                return true;
            }
            if (_loc_2 != null && _loc_2.stask.code == GameConst.GuideDefenceCopyTaskCode && _loc_2.isDoing())
            {
                if (CopyUtil.isInGuideDefenseCopy && (_loc_2.curStep == 2 || _loc_2.curStep == 3))
                {
                    return false;
                }
                if (!CopyUtil.isInGuideDefenseCopy)
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.GroupCopyOpenByIndexOpenOnly, GroupCopyModule.DefenCopy));
                }
                else
                {
                    MsgManager.showRollTipsMsg(Language.getString(21235));
                }
                return true;
            }
            return false;
        }// end function

        public function get guildTaskGetWin() : GuildTaskGetWinNew
        {
            return this._guildTaskGetWin;
        }// end function

    }
}
